#ifndef _LT_IENTITY_H_
#define _LT_IENTITY_H_

#include "ltSaveData.h"
#include "fastsig/fastsig.hpp"
#include <list>

namespace OgreOde
{
	class Contact;
}

namespace Lotus
{
	class MapState;

	class LOTUS_API MapObject: public fastsig::trackable
	{
	friend class MapState;
	public:
		MapObject();
		virtual ~MapObject();
		MapObject* clone() const;

		virtual void onMapBegin();
		virtual void onMapEnd();
		virtual void onUpdate();
		virtual void onChildAttached(MapObject* child);
		virtual void onChildDetached(MapObject* child);
		void attachTo(MapObject* parent);
		MapObject* getParent();
		virtual void onLoad(const SaveData& saveData);
		virtual void onSave(SaveData& saveData) const;

		virtual void setNode(Ogre::SceneNode* newNode);
		virtual const Ogre::Vector3 getRotation() const;
		virtual void setRotation(const Ogre::Vector3& rot);
		virtual const Ogre::Vector3& getPosition() const;
		virtual void setPosition(const Ogre::Vector3& pos);
		virtual const Ogre::Vector3&  getScale() const;
		virtual void setScale(const Ogre::Vector3& scale);

		void setName(const char* name);
		const std::string& getName() const;

		MapState* getMap() const;

	protected:
		virtual void onCreate()=0;

		std::string name;
		std::list<MapObject*> childObjectList;
		MapObject* parent;
		bool active;
		fastsig::connection updateConnection;
		Ogre::SceneNode* node;

	private:
		MapState* map;
	};
}

#endif